﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using EluZSProvider;
using System.Web;
using System.Data;

namespace WebSys.UI.Control.ZhengShou
{
    public class ChanQuanZhiHuanXieYiQianShuInOneControl : MPBasicTemplate
    {
        EluZSDataProvider _EluZSDataProvider = (EluZSDataProvider)ProviderService.ProviderServiceMange.GetProvider("EluZSProvider"); 
        public string userid = string.Empty;
        Label lblCQQSRQ, lblCQZZRQ, lblXMDD, lblCQSSDW, lblITEM_NAME;
        protected override void OnLoad(EventArgs e)
        {
            if (HttpContext.Current.Session["UserID"] == null)
            {
                Antu.Utilities.UtilitiesPage.AlertDialogClear("登录超时，请重新登录！", "window.parent.location.href('../login.aspx');");
            }
            else
            {
                userid = HttpContext.Current.Session["UserID"].ToString();
            }
            base.OnLoad(e);
            InitControl();
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            Panel panel1 = (Panel)FindControl("panel1");
            if (!base.Page.IsPostBack)
            {
                Persistence1.Table = "zs_cqzhxy";
                Persistence1.Key = "ID";
                Persistence1.KeyValue = HttpContext.Current.Request["id"];
                Persistence1.ConnStr = _EluZSDataProvider.GetConnectionString();
            }
            Persistence1.BindControl = panel1;
            BindData();
            Button Button3 = (Button)FindControl("Button3");
            Button Button7 = (Button)FindControl("Button7");
            LinkButton LinkButton1 = (LinkButton)FindControl("LinkButton1");
            if (_EluZSDataProvider.IsQZSBM(userid))
            {
                Button3.Visible = false;//审核通过按钮，以后要去掉
                LinkButton1.Visible = false;
                Page.ClientScript.RegisterStartupScript(this.GetType(), "displaytr", "<script>displaytr();</script>");
            }
            if (!_EluZSDataProvider.IsNetZSAdmin(userid) && !_EluZSDataProvider.IsZSAdmin(userid))
            {
                Button3.Visible = false;
            }
            if (!_EluZSDataProvider.IsNetZSAdmin(userid) && !_EluZSDataProvider.IsZSAdmin(userid) && !_EluZSDataProvider.IsSZSB(userid))
            {
                Button7.Visible = false;
            }
            ImageButton ImageButton1 = (ImageButton)FindControl("ImageButton1");
            
            if (string.IsNullOrEmpty(HttpContext.Current.Request["id"]))
            {
                ImageButton1.Visible = false;
                LinkButton1.Visible = false;
            }
            string SPUsersIds = System.Configuration.ConfigurationManager.AppSettings["SPTGRY"].ToString();
            if (SPUsersIds.IndexOf(userid) > -1) { Button3.Visible = true; }
            string CXUsersIds = System.Configuration.ConfigurationManager.AppSettings["CXTJRY"].ToString();
            if (CXUsersIds.IndexOf(userid) > -1) { Button7.Visible = true; }
            TJSHYZ();
            Button Button8 = (Button)FindControl("Button8");
            Button8.Click += new EventHandler(Button8_Click);
        }


   

        protected void Button8_Click(object sender, EventArgs e)
        {
            string sql = "update zs_cqzhxy set 审核状态 = 0 where id = '" + Page.Request["ID"] + "'";
            string num = _EluZSDataProvider.GetString(sql);
            Button Button8 = (Button)FindControl("Button8");
            Button8.Enabled = false;
            Button Button2 = (Button)FindControl("Button2");
            Button2.Enabled = false;
            Button Button3 = (Button)FindControl("Button3");
            Button3.Enabled = true;
        }


        //提交审核验证
        protected void TJSHYZ()
        {
            if (Page.Session["UserID"] != null)
            {
                string sql = @"Select rolename From zs_role Where Id in
                         ( Select roleid From zs_user_in_role Where Userid = '" + Page.Session["UserID"] + "')";
                DataTable rolename = _EluZSDataProvider.GetTable(sql);
                for (int i = 0; i < rolename.Rows.Count; i++)
                {
                    if (rolename.Rows[i]["rolename"].ToString().Equals("区县录入人员"))
                    {
                           string sql2 = "Select * from zs_cqzhxy where fid ='" + Page.Request["fid"] + "'";
                        DataTable istrue = _EluZSDataProvider.GetTable(sql2);
                        if (istrue.Rows.Count < 1)
                        {
                            Button Button1 = (Button)FindControl("Button1");
                            Button1.Visible = true;
                            Button Button4 = (Button)FindControl("Button4");
                            Button4.Visible = false;
                            Button Button8 = (Button)FindControl("Button8");
                            Button8.Visible = false;
                            Button Button2 = (Button)FindControl("Button2");
                            Button2.Visible = false;
                            Button Button3 = (Button)FindControl("Button3");
                            Button3.Visible = true;
                            Button Button7 = (Button)FindControl("Button7");
                            Button7.Visible = false;
                        }
                        else
                        {
                            if (istrue.Rows[0]["审核状态"].ToString().Equals("1"))
                            {
                                Button Button1 = (Button)FindControl("Button1");
                                Button1.Enabled = false;
                                Button Button3 = (Button)FindControl("Button3");
                                Button3.Visible = true;
                                Button3.Enabled = false;
                            }
                            if (istrue.Rows[0]["审核状态"].ToString().Equals("0"))
                            {
                                Button Button1 = (Button)FindControl("Button1");
                                Button1.Enabled = true;
                                Button Button3 = (Button)FindControl("Button3");
                                Button3.Visible = true;
                                Button3.Enabled = true;
                            }

                            Button Button7 = (Button)FindControl("Button7");
                            Button Button2 = (Button)FindControl("Button2");
                            Button Button8 = (Button)FindControl("Button8");
                            Button7.Visible = false;
                            Button2.Visible = false;
                            Button8.Visible = false;
                        }
                    }
                    if (rolename.Rows[i]["rolename"].ToString().Equals("区县组长"))
                    {
                        Button Button3 = (Button)FindControl("Button3"); //提交
                        Button3.Visible = false;
                        Button Button1 = (Button)FindControl("Button1"); //提交
                        Button1.Visible = false;
                        Button Button7 = (Button)FindControl("Button7"); //提交
                        Button7.Visible = false;
                        Button Button2 = (Button)FindControl("Button2"); //提交
                        Button2.Visible = true;
                        Button Button8 = (Button)FindControl("Button8"); //提交
                        Button8.Visible = true;
                        if (Page.Request["ID"] != null)
                        {
                            string sql1 = " Select * From zs_cqzhxy Where Id = '" + Page.Request["ID"] + "'";
                            System.Data.DataTable dt = _EluZSDataProvider.GetDTTable(sql1);
                            if (dt.Rows.Count == 1)
                            {
                                if (dt.Rows[0]["审核状态"].ToString().Equals("0") || dt.Rows[0]["提交备案"].ToString().Equals("1"))
                                {
                                    Button8.Enabled = false;
                                    Button2.Enabled = false;
                                }
                                if (dt.Rows[0]["审核状态"].ToString().Equals("1") && dt.Rows[0]["提交备案"].ToString().Equals("0"))
                                {
                                    Button2.Enabled = true;
                                    Button8.Enabled = true;

                                }
                            }
                        }
                    }
                    string sub = rolename.Rows[i]["rolename"].ToString().Substring(0, 4);
                    if (sub.Equals("市征收办"))
                    {
                        Button Button8 = (Button)FindControl("Button8"); //提交
                        Button8.Visible = false;
                        Button Button1 = (Button)FindControl("Button1"); //提交
                        Button1.Visible = false;
                        Button Button7 = (Button)FindControl("Button7"); //提交
                        Button7.Visible = true;
                        Button Button2 = (Button)FindControl("Button2"); //提交
                        Button2.Visible = false;
                        Button Button3 = (Button)FindControl("Button3"); //提交
                        Button3.Visible = false;

                        string sql1 = " Select * From zs_cqzhxy Where Id = '" + Page.Request["ID"] + "' ";
                        System.Data.DataTable dt = _EluZSDataProvider.GetDTTable(sql1);

                        if (dt.Rows[0]["提交备案"].ToString().Equals("0") || dt.Rows[0]["审核状态"].ToString().Equals("0"))
                        {
                            Button7.Enabled = false;
                        }
                        if (dt.Rows[0]["提交备案"].ToString().Equals("1") && dt.Rows[0]["审核状态"].ToString().Equals("1"))
                        {
                            Button7.Enabled = true;
                        }

                    }
                    if (rolename.Rows[i]["rolename"].ToString().Equals("超级管理员"))
                    {
                        Button Button8 = (Button)FindControl("Button8"); //提交
                        Button8.Visible = true;
                        Button8.Enabled = false;
                        Button Button1 = (Button)FindControl("Button1"); //提交
                        Button1.Visible = true;
                        Button1.Enabled = false;
                        Button Button7 = (Button)FindControl("Button7"); //提交
                        Button7.Visible = true;
                        Button7.Enabled = false;
                        Button Button2 = (Button)FindControl("Button2"); //提交
                        Button2.Visible = true;
                        Button2.Enabled = false;
                        Button Button3 = (Button)FindControl("Button3"); //提交
                        Button3.Visible = true;
                        Button3.Enabled = false;
                        string sql1 = " Select * From zs_cqzhxy Where Id = '" + Page.Request["ID"] + "'";
                        System.Data.DataTable dt = _EluZSDataProvider.GetDTTable(sql1);
                        if (dt.Rows.Count > 0)
                        {
                            if (dt.Rows[0]["审核状态"].ToString().Equals("1") && dt.Rows[0]["提交备案"].ToString().Equals("0"))
                            {
                                Button2.Enabled = true;
                                Button8.Enabled = true;
                            }
                            if (dt.Rows[0]["审核状态"].ToString().Equals("0") && dt.Rows[0]["提交备案"].ToString().Equals("0"))
                            {
                                Button8.Enabled = true;
                            }
                            if (dt.Rows[0]["提交备案"].ToString().Equals("1") && dt.Rows[0]["审核状态"].ToString().Equals("1"))
                            {
                                Button7.Enabled = true;
                            }
                            if (dt.Rows[0]["提交备案"].ToString().Equals("0") && dt.Rows[0]["审核状态"].ToString().Equals("1"))
                            {

                                Button2.Enabled = true;
                                Button8.Enabled = true;
                            }
                        }
                        else {
                            Button1.Enabled = true;
                            Button3.Enabled = true;
                        }
                    }
                }
            }
        }

        protected void InitControl() {
            lblCQQSRQ = (Label)FindControl("lblCQQSRQ");
            lblCQZZRQ = (Label)FindControl("lblCQZZRQ");
            lblXMDD = (Label)FindControl("lblXMDD");
            lblCQSSDW = (Label)FindControl("lblCQSSDW");
            lblITEM_NAME = (Label)FindControl("lblITEM_NAME");
        }
        protected override void OnPreRender(EventArgs e) {
            base.OnPreRender(e);
            Panel panel1 = (Panel)FindControl("panel1");
            TextBox txtTextBox6 = (TextBox)FindControl("txtTextBox6");
            TextBox txtTextBox7 = (TextBox)FindControl("txtTextBox7");
            TextBox txtTextBox8 = (TextBox)FindControl("txtTextBox8");
            TextBox txtTextBox9 = (TextBox)FindControl("txtTextBox9");
            TextBox txtTextBox10 = (TextBox)FindControl("txtTextBox10");
            TextBox txtTextBox11 = (TextBox)FindControl("txtTextBox11");
            TextBox txtTextBox12 = (TextBox)FindControl("txtTextBox12");
            TextBox txtTextBox13 = (TextBox)FindControl("txtTextBox13");
            TextBox txtTextBox14 = (TextBox)FindControl("txtTextBox14");
            TextBox txtTextBox15 = (TextBox)FindControl("txtTextBox15");
            TextBox txtTextBox16 = (TextBox)FindControl("txtTextBox16");
            TextBox txtTextBox17 = (TextBox)FindControl("txtTextBox17");
            TextBox txtIID = (TextBox)FindControl("txtIID");
            TextBox txtFID = (TextBox)FindControl("txtFID");
            TextBox txtCAN_SYNC = (TextBox)panel1.FindControl("txtCAN_SYNC");
            TextBox txtZSJDH = (TextBox)FindControl("txtZSJDH");
            string fid = HttpContext.Current.Request["FID"];
            if (!string.IsNullOrEmpty(fid))
            {
                EluZSProvider.ProLoupan proloupan = _EluZSDataProvider.GetProLoupanRoom(fid);
                string strZSRID = proloupan.Zspid;
                if (!string.IsNullOrEmpty(strZSRID))
                {
                    EluZSProvider.ZSPERSON zsperson = _EluZSDataProvider.GetZSPERSON(strZSRID);
                    if (string.IsNullOrEmpty(txtTextBox7.Text)) { txtTextBox7.Text = zsperson.产权人; }
                    if (string.IsNullOrEmpty(txtTextBox13.Text)) { txtTextBox13.Text = zsperson.房屋坐落; }
                    if (string.IsNullOrEmpty(txtTextBox14.Text)) { txtTextBox14.Text = zsperson.产权人; }
                    if (string.IsNullOrEmpty(txtTextBox15.Text)) { txtTextBox15.Text = zsperson.承租人; }
                    if (string.IsNullOrEmpty(txtTextBox8.Text)) { txtTextBox8.Text = zsperson.承租人; }
                }
            }
            string strPID = HttpContext.Current.Request["PID"];
            if (!string.IsNullOrEmpty(strPID))
            {
                EluZSProvider.Project project = _EluZSDataProvider.GetProjectXX(strPID);
                lblCQSSDW.Text = project.征收部门;
                lblITEM_NAME.Text = project.项目名称;
                if (string.IsNullOrEmpty(txtTextBox6.Text)) { txtTextBox6.Text = project.征收部门; }
                if (string.IsNullOrEmpty(txtTextBox12.Text)) { txtTextBox12.Text = project.区属; }
                if (string.IsNullOrEmpty(txtTextBox16.Text)) { txtTextBox16.Text = project.征收部门; }
                if (string.IsNullOrEmpty(txtTextBox17.Text)) { txtTextBox17.Text = project.评估机构; }
                string myzs = _EluZSDataProvider.GetSomeStr("zs_prono", "征收许可证号", "pid", strPID);
                if (string.IsNullOrEmpty(txtZSJDH.Text))
                {
                    txtZSJDH.Text = _EluZSDataProvider.GetSomeStr("zs_prono", "征收许可证号", "pid", strPID);
                }
                string tt1 = myzs.Replace("宁", "|");
                string tt2 = tt1.Replace("府征字（", "|");
                string tt3 = tt2.Replace("年第", "|");
                string tt4 = tt3.Replace("号）", "|");
                string tt5 = tt4.Replace("|", ",");
                String[] tt6 = tt5.Split(',');
                if (tt6.Length > 1)
                {
                    if (string.IsNullOrEmpty(txtTextBox9.Text)) { txtTextBox9.Text = tt6[1]; }
                    if (string.IsNullOrEmpty(txtTextBox10.Text)) { txtTextBox10.Text = tt6[2]; }
                    if (string.IsNullOrEmpty(txtTextBox11.Text)) { txtTextBox11.Text = tt6[3]; }
                }
            }
            if (string.IsNullOrEmpty(txtIID.Text)) { txtIID.Text = _EluZSDataProvider.GetXYIID(); }
            if (string.IsNullOrEmpty(txtFID.Text)) { txtFID.Text = HttpContext.Current.Request["FID"]; }
            if (string.IsNullOrEmpty(HttpContext.Current.Request["ID"])) { if (string.IsNullOrEmpty(txtFID.Text)) { txtCAN_SYNC.Text = "0"; } }
            
        }
        protected void BindData() {
            Panel panel1 = (Panel)FindControl("panel1");
            Button btnUpload = (Button)FindControl("btnUpload");
            Button Button1 = (Button)FindControl("Button1");
            Button Button2 = (Button)FindControl("Button2");
            Button Button3 = (Button)FindControl("Button3");
            Button Button4 = (Button)FindControl("Button4");
            Button Button5 = (Button)FindControl("Button5");
            Button Button6 = (Button)FindControl("Button6");
            Button Button7 = (Button)FindControl("Button7");
            ImageButton ImageButton1 = (ImageButton)FindControl("ImageButton1");
            LinkButton LinkButton1 = (LinkButton)FindControl("LinkButton1");
            btnUpload.Click += new EventHandler(BtnUpload_Click);
            Button1.Click += new EventHandler(BtnSave_Click);
            Button2.Click += new EventHandler(BtnTijiao_Click);
            Button3.Click += new EventHandler(button3_Click);
            Button4.Click += new EventHandler(button4_Click);
            Button5.Click += new EventHandler(Button5_Click);
            Button6.Click += new EventHandler(Button6_Click);
            Button7.Click += new EventHandler(button7_Click);
            ImageButton1.Click += new ImageClickEventHandler(ImageButton1_Click);
            LinkButton1.Click += new EventHandler(linkButton1_Click);
            if (_EluZSDataProvider.IsQZSBM(userid))
            {
                Button3.Visible = false;//审核通过按钮，以后要去掉
                LinkButton1.Visible = false;
                Page.ClientScript.RegisterStartupScript(this.GetType(), "displaytr", "<script>displaytr();</script>");
            }
            if (!_EluZSDataProvider.IsNetZSAdmin(userid) && !_EluZSDataProvider.IsZSAdmin(userid))
            {
                Button3.Visible = false;
            }
            if (!_EluZSDataProvider.IsNetZSAdmin(userid) && !_EluZSDataProvider.IsZSAdmin(userid) && !_EluZSDataProvider.IsSZSB(userid))
            {
                Button7.Visible = false;
            }
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            Persistence1.Update();
            HttpContext.Current.Response.Redirect("ChanQuanZhiHuanXieYiQianShuInOne.aspx?ID=" + Persistence1.KeyValue + "&PID=" + HttpContext.Current.Request["PID"] + "&FID=" + HttpContext.Current.Request["FID"] + "&ZID=" + HttpContext.Current.Request["ZID"] + "&query=loupan");
        }
        /// <summary>
        /// 协议附件上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnUpload_Click(object sender, EventArgs e)
        {
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            if (!string.IsNullOrEmpty(Persistence1.KeyValue))
            {
                string strScript = string.Format("<script>OpenFileUpload('{0}','{1}','{2}','{3}');</script>", "101",
                    Persistence1.KeyValue, HttpContext.Current.Request["ID"].Trim(), HttpContext.Current.Request["PID"].Trim());
                Page.ClientScript.RegisterStartupScript(this.GetType(), "opennew", strScript);
            }
        }
        /// <summary>
        /// 提交事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnTijiao_Click(object sender, EventArgs e)
        {
            string strID = HttpContext.Current.Request["ID"];
            _EluZSDataProvider.GetProjectZT("zs_cqzhxy", "bsw", strID, "0");
            string strPID = base.Page.Request["PID"];
            if (_EluZSDataProvider.CkFileCount(strPID, "101")) { _EluZSDataProvider.UpdateFileCS(strPID, "101"); }
            if (_EluZSDataProvider.CkFileCount(strPID, "1011")) { _EluZSDataProvider.UpdateFileCS(strPID, "1011"); }
            if (_EluZSDataProvider.CkFileCount(strPID, "1012")) { _EluZSDataProvider.UpdateFileCS(strPID, "1012"); }
            TextBox TextBox2 = (TextBox)FindControl("txtTextBox2");
            string sql = "update zs_cqzhxy set 提交备案 =1 where id = '"+Page.Request["ID"]+"'";
            string num = _EluZSDataProvider.GetString(sql);
            Button Button8 = (Button)FindControl("Button8");
            Button8.Enabled = false;
            Button Button2 = (Button)FindControl("Button2");
            Button2.Enabled = false;
            Button Button7 = (Button)FindControl("Button7");
            Button7.Enabled = true;
        }
        /// <summary>
        /// 审核通过事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void button3_Click(object sender, EventArgs e)
        {
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            Persistence1.Update();
            string sql = "update zs_cqzhxy set 审核状态=1 where id='" + Page.Request["ID"] + "'";
            string isTJ = _EluZSDataProvider.GetString(sql);
            if (isTJ.Equals("1"))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "s2", "<script>alert('提交审核成功!');</script>");
            }

            Button Button8 = (Button)FindControl("Button8");
            Button8.Enabled = true;
            Button Button1 = (Button)FindControl("Button1");
            Button1.Visible = false;
            Button Button2 = (Button)FindControl("Button2");
            Button2.Enabled = true;
            Button Button3 = (Button)FindControl("Button3");
            Button3.Enabled = false;
            Button Button7 = (Button)FindControl("Button7");
            Button7.Enabled = false;
        }
        /// <summary>
        /// 返回事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void button4_Click(object sender, EventArgs e)
        {
            string strPID = HttpContext.Current.Request["PID"];
            string strZID = HttpContext.Current.Request["ZID"];
            string strID = HttpContext.Current.Request["FID"];
            string type = HttpContext.Current.Request["type"];
            if (!string.IsNullOrEmpty(strPID))
            {
                if (!string.IsNullOrEmpty(strZID))
                {
                    HttpContext.Current.Response.Redirect("ProLoupan.aspx?PID=" + strPID + "&ZID=" + strZID + "&query=cqzh");
                }
                if (!string.IsNullOrEmpty(type))
                {
                    if (type == "1")
                    {
                        HttpContext.Current.Response.Redirect("FangSan.aspx?PID=" + strPID + "&query=cqzh");
                    }
                }
            }
        }
        /// <summary>
        /// 其他附件上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button5_Click(object sender, EventArgs e)
        {
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            if (!string.IsNullOrEmpty(Persistence1.KeyValue))
            {
                string strScript = string.Format("<script>OpenFileUpload('{0}','{1}','{2}','{3}');</script>", "1011",
                    Persistence1.KeyValue, HttpContext.Current.Request["ID"].Trim(), HttpContext.Current.Request["PID"].Trim());
                Page.ClientScript.RegisterStartupScript(this.GetType(), "opennew", strScript);
            }
        }
        /// <summary>
        /// 其他附件上传
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button6_Click(object sender, EventArgs e)
        {
            MPPersistence Persistence1 = (MPPersistence)FindControl("Persistence1");
            if (!string.IsNullOrEmpty(Persistence1.KeyValue))
            {
                string strScript = string.Format("<script>OpenFileUpload('{0}','{1}','{2}','{3}');</script>", "1012",
                    Persistence1.KeyValue, HttpContext.Current.Request["ID"].Trim(), HttpContext.Current.Request["PID"].Trim());
                Page.ClientScript.RegisterStartupScript(this.GetType(), "opennew", strScript);
            }
        }
        /// <summary>
        /// 撤销备案
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void button7_Click(object sender, EventArgs e)
        {
            string sql = "update zs_cqzhxy set 提交备案 = 0 where id = '" + Page.Request["ID"] + "'";
            string num = _EluZSDataProvider.GetString(sql); 
            Button Button7 = (Button)FindControl("Button7");
            Button7.Enabled = false;
            Button Button2 = (Button)FindControl("Button2");
            Button2.Enabled = true;
            Button Button8 = (Button)FindControl("Button8");
            Button8.Enabled = true;
        }
        /// <summary>
        /// 打印按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ImageButton1_Click(object sender, EventArgs e)
        {
            string strID = HttpContext.Current.Request["id"];
            if (!string.IsNullOrEmpty(strID))
            {
                int tt = Convert.ToInt32(_EluZSDataProvider.GetSomeStr("zs_cqzhxy", "打印次数", "id", strID));
                string temp = (tt + 1).ToString();
                _EluZSDataProvider.UpdateSomething("zs_cqzhxy", "打印次数", temp, "id", strID);
                _EluZSDataProvider.InsertSomething("ZS_XYDYRY", "xyid,userid,type", string.Format("'{0}','{1}','0'", strID,userid));
                string strScript = string.Format("<script>openPrint('{0}','{1}');</script>", HttpContext.Current.Request["fid"], strID);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "openPrint", strScript);
            }
        }
        /// <summary>
        /// 打印人员留痕
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void linkButton1_Click(object sender, EventArgs e)
        {
            HttpContext.Current.Response.Redirect("ZS_DYRYLH.aspx?PID=" + HttpContext.Current.Request["PID"] + "&ZID=" + HttpContext.Current.Request["ZID"] + "&ID=" + HttpContext.Current.Request["ID"] + "&FID=" + HttpContext.Current.Request["FID"] + "&action=edit&type=0");
        }
    }
}
